package com.smile.service.impl;


import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.smile.commons.gps.GeoConvertUtils;
import com.smile.mapper.AirportDroneMapper;
import com.smile.mapper.AirportInfoMapper;
import com.smile.mapper.AirportMapper;
import com.smile.mapper.FlightLogMapper;
import com.smile.model.domain.FeisuanAirport;
import com.smile.model.domain.FeisuanAirportDrone;
import com.smile.model.domain.FeisuanDrone;
import com.smile.model.domain.FeisuanFlightLog;
import com.smile.model.dto.request.*;
import com.smile.model.response.response.*;
import com.smile.service.FlightLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;

@Service
@Slf4j
public class FlightLogServiceImpl implements FlightLogService {
    @Autowired
    private AirportMapper airportMapper;


    @Autowired
    private AirportDroneMapper airportDroneMapper;

    private ReentrantLock reentrantLock = new ReentrantLock();


    @Autowired
    private FlightLogMapper flightLogMapper;
    @Override
    public List<FeisuanFlightLogResponseDTO> getFlightLogList(GetFlightLogRequestDTO getFlightLogRequestDTO) {

        QueryWrapper<FeisuanFlightLog> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("flight_id",getFlightLogRequestDTO.getFlightId());
        List<FeisuanFlightLog> list = flightLogMapper.selectList(queryWrapper);
        List<FeisuanFlightLogResponseDTO> responseDTOList = BeanUtil.copyToList(list, FeisuanFlightLogResponseDTO.class);
        return responseDTOList;
    }
}
